﻿<UserControl x:Class="AutomationMLMapper.Controls.CollapsibleColumnHeader"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
             xmlns:ConvertersAndTemplateSelectors="clr-namespace:AutomationMLMapper.Controls.ConvertersAndTemplateSelectors"
             xmlns:Properties="clr-namespace:AutomationMLMapper.Properties" mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/AutomationMLMapper;component/StyleResources/ListStyle.xaml"/>
                <ResourceDictionary Source="/AutomationMLMapper;component/StyleResources/Templates.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <ConvertersAndTemplateSelectors:BoolToVisibilityConverter FalseValue="Collapsed" x:Key="btvc" />
        </ResourceDictionary>
    </UserControl.Resources>
    
    <Grid>
        <Grid.Resources>
            <Style x:Key="ShowHideButtonStyle" TargetType="{x:Type ribbon:RibbonToggleButton}">
                <Setter Property="Label" Value="Show Column"></Setter>
                <Style.Triggers>
                    <Trigger Property="IsChecked" Value="True">
                        <Setter Property="Label" Value="Hide Column"></Setter>
                    </Trigger>
                    <Trigger Property="IsChecked" Value="False">
                        <Setter Property="Label" Value="Show Column"></Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="50" Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <ribbon:RibbonSplitButton x:Name="SplitButton" ToolTipImageSource="/AutomationMLMapper;component/Images/Info.ico" 
                                  Grid.Column="0" >
            <ribbon:RibbonToggleButton  Style="{StaticResource ShowHideButtonStyle}" HorizontalAlignment="Left" x:Name="ShowButton"  
                                        Click="HeaderButtonClick" 
                                        SmallImageSource="/AutomationMLMapper;component/Images/ShowColumn.png">
            </ribbon:RibbonToggleButton>
            <ribbon:RibbonButton Click="RibbonButtonClick" HorizontalAlignment="Left" 
                                 Label="{x:Static Properties:Resources.ExpandCollapseAll}" 
                                 SmallImageSource="/AutomationMLMapper;component/Images/expandDown.png"></ribbon:RibbonButton>
        </ribbon:RibbonSplitButton>
        <!--<ToggleButton VerticalAlignment="Center" Style="{StaticResource HeaderToggleButtonStyle}"
			          Click="HeaderButton_Click">
            <Image x:Name="HeaderImage"></Image>
        </ToggleButton>-->
        <TextBlock x:Name="HeaderTextBlock" Grid.Column="1" 
                   Visibility="{Binding ElementName=ShowButton, Path=IsChecked, Converter={StaticResource btvc}}" 
                   VerticalAlignment="Center"  Margin="5,0,5,0"></TextBlock>
    </Grid>
</UserControl>
